#!/bin/bash


export RESTITORY=http://restitory.appspot.com

curl -X PUT $RESTITORY/_/crypto/key/master -H "Expect:" -d ""
curl -X PUT $RESTITORY/u/admin/password -H "Content-Type: text/plain" -H "Expect:" -d "admin"
curl -X PUT $RESTITORY/u/admin/roles -H "Content-Type: application/json" -H "Expect:" -d "['admin']"
curl -X PUT $RESTITORY/_/auth/simple/config -H "Content-Type: application/json" -H "Expect:" -d "{queryPassword:'/u/{0}/password'}"
curl -X PUT $RESTITORY/_/access/config -H "Content-Type: application/json" -H "Expect:" -d "{queryRoles:'/u/{0}/roles', access: { admin: [ { method: '.*', path: '/.*' } ], viewer: [ { method: 'GET', path: '/v/.*' } ] }}"

export RESTITORY_KEY=$(curl -X GET "$RESTITORY/_/auth/simple?u=admin&p=admin&s=restitory")

curl -X GET "$RESTITORY/_/crypto/key/master/public" -H "X-Restitory-Auth: $RESTITORY_KEY"  




